<?php
	/* 
	 * 配置选项
	 */	
	
	switch($ts){
		//配置
		case "":
			$arrOptions = $DB->fetch_all_assoc("select * from ".dbprefix."app_user_options");
			foreach($arrOptions as $item){
				$strOption[$item['optionname']] = $item['optionvalue'];
			}
			include TmooTemplate("admin/options");
			break;
		//配置执行
		case "do":
			$arrOption = array(
				'appname' => trim($_POST['appname']),
				'appdesc' => trim($_POST['appdesc']),
				'isenable' => trim($_POST['isenable']),
				'isregister' => trim($_POST['isregister']),
				'isvalidate' => trim($_POST['isvalidate']),
				'isrewrite' => trim($_POST['isrewrite']),
				'isgroup'	=> trim($_POST['isgroup']),
			);
			foreach ($arrOption as $key => $val){
				$DB->query("UPDATE ".dbprefix."app_user_options SET optionvalue='$val' where optionname='$key'");
			}
			AppCacheWrite($arrOption,'user','options.php');
			header("Location: index.php?app=user&ac=admin&mg=options");
			break;
	}